package com.yc.chatroom.server.controller;

import com.yc.chatroom.common.dto.ResultDto;
import com.yc.chatroom.common.dto.LoginDto;
import com.yc.chatroom.server.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.security.auth.message.AuthException;

@RestController
@RequestMapping("/auth")
public class AuthController {

    @Autowired
    private AuthService loginService;

    @PostMapping("/login")
    public ResultDto login(@RequestBody LoginDto dto) throws AuthException {

        return loginService.loginHandler(dto);
    }
}
